package com.sen.paydemo.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.net.InetAddress;

/**
 * 测试页访问地址输出
 */
@Component
@Slf4j
public class CommandLineRunnerImpl implements CommandLineRunner {

    @Value("${server.port}")
    private String port;

    @Override
    @Async
    public void run(String... args) throws Exception {
        InetAddress address = InetAddress.getLocalHost();
        // 这里填上自己的端口
        log.info("Knife4j 接口测试地址 : http://{}", address.getHostAddress() +":" +port + "/doc.html");
    }
}
